package com.hujinwen.control;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.hujinwen.service.ESService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Created by joe on 2020/3/16
 * <p>
 * es 操作控制
 */
@RestController
public class ESControl {

    @Autowired
    private ESService esService;

    /**
     * 查询笔记
     */
    @PostMapping("/queryNote")
    public String queryNote(String kw) throws IOException {
        return esService.queryNote(kw);
    }

    /**
     * 新增笔记
     */
    @PostMapping("/putNote")
    public String putNote(String title, String tags, String content) throws JsonProcessingException {
        return esService.putNote(title, tags, content);
    }

}
